package com.niiwoo.civet.user.service.duboo;

import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.fastjson.JSON;
import com.niiwoo.civet.user.dto.response.BeInviterUserInfoRespDTO;
import com.niiwoo.civet.user.dto.response.InviterUserInfoRespDTO;
import com.niiwoo.civet.user.service.UserInviteRegisterDubboService;
import com.niiwoo.civet.user.service.local.UserInviteRegisterService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Author: wuke
 * @Description:
 * @Date: Created in 15:34 2018/3/26
 */
@Slf4j
@Service(version = "1.0.0")
public class UserInviteRegisterDubboServiceImpl implements UserInviteRegisterDubboService {
    @Autowired
    UserInviteRegisterService userInviteRegisterService;

    /**
     * 根据被邀请人用户ID查询邀请人信息
     * @param userId
     * @return
     */
    public InviterUserInfoRespDTO queryInviterUserInfo(String userId){
        log.info("queryInviterUserInfo.userId={}",userId);
        InviterUserInfoRespDTO respDTO = userInviteRegisterService.queryInviterUserInfo(userId);
        log.info("queryInviterUserInfo.userId={},respDTO={}",userId, JSON.toJSONString(respDTO));
        return respDTO;
    }

    /**
     * 查询被邀请人信息列表
     * @param userId
     * @return
     */
    public List<BeInviterUserInfoRespDTO> queryBeInviterUserInfo(String userId){
        log.info("queryBeInviterUserInfo.userId={}",userId);
        List<BeInviterUserInfoRespDTO> beInviterUserInfoRespDTOList = userInviteRegisterService.queryBeInviterUserInfo(userId);
        log.info("queryBeInviterUserInfo.userId={},beInviterUserInfoRespDTOList={}",userId, JSON.toJSONString(beInviterUserInfoRespDTOList));
        return beInviterUserInfoRespDTOList;
    }
}
